﻿using System.Collections.Generic;
using System.ComponentModel;

namespace StepsManagerLibrary.Interfaces
{
    /// <summary>
    /// Defines a set of methods required to managed a collection of steps
    /// </summary>
    /// <typeparam name="T">Type of the Step that will be managed</typeparam>
    public interface IStepManager<T> : INotifyPropertyChanged
    {
        #region Properties

        /// <summary>
        /// Collection of steps
        /// </summary>
        IList<T> Steps { get; set; }

        /// <summary>
        /// Current step of the application
        /// </summary>
        T CurrentStep { get; }

        #endregion

        #region Steps List

        /// <summary>
        /// Access the Step at the specific position
        /// </summary>
        /// <param name="i">Position</param>
        /// <returns>Step at the position</returns>
        T this[int i] { get; }

        /// <summary>
        /// Add a Step at the end of the current collection of steps
        /// </summary>
        /// <param name="step">Step to be added</param>
        /// <returns>The position of the added step</returns>
        int AddStep(T step);

        /// <summary>
        /// Insert a step at a specific position in the list
        /// </summary>
        /// <param name="step">Step to be added</param>
        /// <param name="pos">Position to add the step</param>
        /// <returns>The position of the added step</returns>
        bool InsertStepAt(T step, int pos);

        /// <summary>
        /// If the step provided exist in the collection
        /// removes the step from the collection
        /// </summary>
        /// <param name="step">Step to be removed</param>
        /// <returns>The step has been found and removed</returns>
        bool RemoveStep(T step);

        #endregion

        #region Navigation
        /// <summary>
        /// Move to the first step
        /// </summary>
        /// <returns>The first step or null if there is none</returns>
        bool GoToFirst();

        /// <summary>
        /// Move to the last step
        /// </summary>
        /// <returns>The last step or null if there is none</returns>
        bool GoToLast();

        /// <summary>
        /// Move to the previous step based on the current context
        /// </summary>
        /// <returns>The previous step</returns>
        bool GoToPrevious();

        /// <summary>
        /// Move to the next step based on the current context
        /// </summary>
        /// <returns>The next step</returns>
        bool GoToNext();

        /// <summary>
        /// Move to a specific step and update the current context
        /// </summary>
        /// <param name="step">Step item</param>
        /// <returns>Expected step</returns>
        bool GoTo(T step); 

        #endregion
    }
}
